home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 4 / Apprentice-Release4.iso / Source Code / C / Code Resources / Jims CDEFs 1.50 / test3D source ƒ / test3D.c < prev    next >
Encoding:
C/C++ Source or Header  |  1995-10-27  |  2.4 KB  |  128 lines  |  [TEXT/KAHL]

  1. //----------------------------------------------------------------------------------
  2. // File        : test3D.c
  3. // Date        : July 23, 1994
  4. // Author    : Jim Stout
  5. //            :
  6. // Purpose    : Test code for the 3D cdef
  7. //----------------------------------------------------------------------------------
  8. #include "debugCDEF.h"
  9. #include "TogLib.h"
  10. #include "movableModal.h"
  11.  
  12. #define sCK1 3
  13. #define sCK2 4
  14. #define sRB1 5
  15. #define sRB2 6
  16.  
  17. #define PB1 7
  18. #define PB2 8
  19.  
  20. #define CK1 9
  21. #define CK2 10
  22. #define RB1 11
  23. #define RB2 12
  24.  
  25. #define LAST 25
  26.  
  27. extern    pascal void CDmain();            // entry point to CDEF in cdef3D.c
  28.  
  29. main()
  30. {
  31.     CJMPhdl                ch;
  32.     DialogPtr            theDialog;
  33.     short                itemHit,t,i;
  34.     Rect                r;
  35.     Point                p;
  36.     ControlHandle        h;
  37.     Boolean                inactive=false;
  38.     
  39.     InitGraf(&qd.thePort);
  40.     InitWindows();
  41.     InitFonts();
  42.     InitMenus();
  43.     TEInit();
  44.     InitCursor();
  45.     InitDialogs(0L);
  46.         
  47.     ch = (CJMPhdl)GetResource('CJMP',128);
  48.     if(ch) {
  49.         (**ch).cdefPtr = (long*)CDmain;
  50.         ChangedResource((Handle)ch);
  51.     }
  52.     else
  53.         ExitToShell();
  54.     
  55.     theDialog = GetNewDialog(128,0L,(DialogPtr)-1);
  56.     if(theDialog) {
  57.         SetPort(theDialog);    
  58.         
  59.     PenPat(&gray);
  60.  
  61. //        TextFont(geneva);
  62. //        TextSize(9);
  63.  
  64.         GetDItem(theDialog, sCK1, &t, (Handle *)&h, &r);
  65.         if(h)
  66.             SetCtlValue(h,!GetCtlValue(h));
  67.         
  68.         GetDItem(theDialog, sRB1, &t, (Handle *)&h, &r);
  69.         if(h)
  70.             SetCtlValue(h,!GetCtlValue(h));
  71.         
  72.         ShowWindow(theDialog);
  73.         
  74.         do {
  75.             movableModalDialog(nil,&itemHit);
  76.             switch(itemHit) {
  77.  
  78.                 case CK1:
  79.                 case CK2:
  80.                 case sCK1:
  81.                 case sCK2:
  82.                     GetDItem(theDialog, itemHit, &t, (Handle *)&h, &r);
  83.                     if(h)
  84.                         SetCtlValue(h,!GetCtlValue(h));
  85.                 break;
  86.  
  87.                 case RB1:
  88.                 case RB2:
  89.                     setRadioButtons(theDialog,itemHit,RB1,RB2);
  90.                 break;
  91.                 
  92.                 case sRB1:
  93.                 case sRB2:
  94.                     setRadioButtons(theDialog,itemHit,sRB1,sRB2);
  95.                 break;
  96.                 case PB1:
  97.                     for(i=sCK1;i<=LAST;i++) {
  98.                         if(i == PB1)
  99.                             continue;
  100.                         GetDItem(theDialog, i, &t, (Handle *)&h, &r);
  101.                         if(inactive)
  102.                             HiliteControl(h, 0);
  103.                         else
  104.                             HiliteControl(h, 0xFF);
  105.                     }
  106.                     inactive = !inactive;
  107.                 break;
  108.             }
  109.         }while(itemHit != 1 && itemHit != 2);
  110.         DisposDialog(theDialog);
  111.     }
  112. }
  113.  
  114. // dummy routines needed by movableModal.c
  115.  
  116. extern void doUpdate        (EventRecord * theEvent);
  117. extern void doPeriodicEvent    (EventRecord * theEvent);
  118. extern void doMenuCommand    (long menuResult);
  119. extern void doUpdate        (EventRecord * theEvent)
  120. {
  121. }
  122. extern void doPeriodicEvent    (EventRecord * theEvent)
  123. {
  124. }
  125. extern void doMenuCommand    (long menuResult)
  126. {
  127. }
  128.